package com.budwk.app.waterquality.controllers.admin;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.waterquality.models.WaterSectionInfo;
import com.budwk.app.waterquality.services.WaterSectionInfoService;
import com.budwk.app.waterquality.vo.QueryCommonParamVo;
import com.budwk.starter.common.openapi.annotation.*;
import com.budwk.starter.common.result.Result;
import com.budwk.starter.common.result.ResultCode;
import com.budwk.starter.log.annotation.SLog;
import com.budwk.starter.security.utils.SecurityUtil;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;

import javax.servlet.http.HttpServletRequest;

@IocBean
@At("/waterquality/admin/water/section/info")
@ApiDefinition(tag = "水质断面检测点成果基本信息表")
@SLog(tag = "水质断面检测点成果基本信息表")
@Slf4j
public class WaterSectionInfoController {

    @Inject
    private WaterSectionInfoService waterSectionInfoService;

    @At
    @Ok("json")
    @POST
    @SLog(value = "分页查询水质断面检测点成果基本信息表")
    @ApiOperation(name = "分页查询水质断面检测点成果基本信息表")
    @ApiResponses(implementation = WaterSectionInfo.class)
//    @SaCheckPermission("waterquality.water.section.info")
    public Result<?> listByPage(@Param("..") QueryCommonParamVo reqVo) {
        return waterSectionInfoService.listByPage(reqVo);
    }

    @At
    @Ok("json")
    @POST
    @SLog(value = "新增水质断面检测点成果基本信息表")
    @ApiOperation(name = "新增水质断面检测点成果基本信息表")
    @ApiFormParams(
        implementation = WaterSectionInfo.class
    )
    @ApiResponses
    public Result<?> create(@Param("..") WaterSectionInfo water) {
        waterSectionInfoService.create(water);
        return Result.success();
    }

}
